﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>首检批次号选择页面</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
</head>
<body>
    <div style="width: 460px">
        <div style="width: 230px; float: left">
            <div class="ufcSectionStyle">
                <span class="ufcSectionSpanStyle">已指定的首件批次号</span>
            </div>
            <table id="gdChekedContainerNo" class="easyui-datagrid" style="width: 100%; height: 300px;"
                data-options="singleSelect:true">
            </table>
        </div>
        <div style="width: 230px; float: left">
            <div class="ufcSectionStyle">
                <span class="ufcSectionSpanStyle">当前批次子序号</span>
            </div>
            <table id="gdCurrContainerNo" class="easyui-datagrid" style="width: 100%; height: 300px;"
                data-options="singleSelect:true">
            </table>
        </div>
        <div class="ufcSectionStyle">
            <span class="ufcSectionSpanStyle">按钮区域</span>
        </div>
        <div style="margin: 3px 0px 3px 3px">
            <a href="#" id="btnSure" class="easyui-linkbutton" style="width: 100px; margin-left: 10px;">
                确定</a>
        </div>
        <div id="statusMessage" style="font-size: 14px; height: 40px">
        </div>
    </div>
</body>
</html>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/json2.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script type="text/javascript">
    var page = {
        rootPath: getRootPath(),
        init: function () {
            page.bind();
            page.bindTemTable();
        },
        bind: function () {
            //已指定的首件批次号
            $("#gdChekedContainerNo").datagrid({
                columns: [[
                 { field: 'ck', title: '选择', width: 30,checkbox:true },
		         { field: 'FIRSTCHECKCONTAINERNO', title: '首件批次号', width: 180 }
                ]],
                onClickRow: function (rowIndex, rowData) {
                    $("#gdCurrContainerNo").datagrid("uncheckAll");
                }
            });
            //已指定的首件批次号
            $("#gdCurrContainerNo").datagrid({
                columns: [[
                 { field: 'ck', title: '选择', width: 30, checkbox: true },
		         { field: 'CONTAINERNAME', title: '子序号', width: 180 }
                ]],
                onClickRow: function (rowIndex, rowData) {
                    $("#gdChekedContainerNo").datagrid("uncheckAll");
                }
            });
            $('#btnSure').on("click", function () {
                var firstNo = "";
                var checkrows = $("#gdChekedContainerNo").datagrid('getChecked');
                if (checkrows.length != 0) {
                    firstNo = checkrows[0].FIRSTCHECKCONTAINERNO;
                }
                var currrows = $("#gdCurrContainerNo").datagrid('getChecked');
                if (currrows.length != 0) {
                    firstNo = currrows[0].CONTAINERNAME;
                }
                if (firstNo == "" || firstNo == null) {
                    displayMessage("未选择首件批次号", false);
                    return;
                }
                parent.window.returnValue = firstNo;
                parent.window.close();
            });
        },

        //获取温度数据
        bindTemTable: function () {
            var containerId = getParam("containerId");
            var productId = getParam("productId");
            var workflowstepid = getParam("workflowstepid");
            var steoformData = {
                action: "GetContainerNoList",
                containerId: containerId,
                productId: productId,
                workFlowStepId: workflowstepid
            };
            $.ajax({
                type: "Post",
                url: page.rootPath + "/Ashx/YePianContainer/YPContaienrHandler.ashx",
                data: steoformData,
                cashe: false,
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    $("#gdChekedContainerNo").datagrid('loaded');
                    var result = JSON.parse(data);
                    $("#gdChekedContainerNo").datagrid('loadData', { rows: result.DBDataSet.Table1 });
                    //
                    $("#gdCurrContainerNo").datagrid('loaded');
                    var result = JSON.parse(data);
                    $("#gdCurrContainerNo").datagrid('loadData', { rows: result.DBDataSet.Table2 });
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    alert(XMLHttpRequest.responseText);
                }
            });
        }
    }
    page.init();
</script>
